<?php
	date_default_timezone_set('Asia/Shanghai');
	session_start();
	set_include_path('.' .PATH_SEPARATOR .'./library'.PATH_SEPARATOR .'./application/models/'.PATH_SEPARATOR . get_include_path());
	require_once 'Zend/Loader.php';
	require_once 'Zend/Session/Namespace.php';
	Zend_Loader::registerAutoload();//设置Zend Framework 自动载入类文件
	$registry = Zend_Registry::getInstance(); 
	$view = new Zend_View();
	$view->setScriptPath('./application/views/scripts/');//设置模板显示路径
	$registry['view'] = $view;//注册View

	//配置数据库参数,并连接数据库
	define('dbhost','localhost');
	define('dbuser','root');
	define('dbpass','');
	define('dbname','lss_db');
	define('APPLICATION_PATH',realpath( './application'));
	$config=new Zend_Config_Ini('./application/configs/config.ini',null, true);
	Zend_Registry::set('config',$config);
	$dbAdapter = Zend_Db::factory($config->general->db->adapter,$config->general->db->config->toArray());
	$dbAdapter->query('SET NAMES UTF8');
	Zend_Db_Table::setDefaultAdapter($dbAdapter);
	Zend_Registry::set('dbAdapter',$dbAdapter);
	

	//设置控制器
	$frontController =Zend_Controller_Front::getInstance();
	$frontController->setBaseUrl('')//设置基本路径
					->setParam('noViewRenderer', true)
					->setControllerDirectory('./application/controllers')
					->throwExceptions(true)
					->dispatch();
?>
					
